package cc.ryanc.halo.web.controller.api;


import cc.ryanc.halo.model.dto.JsonResult;
import cc.ryanc.halo.service.ReptileMessageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * 2018/11/02
 *
 * @author admin
 */
@Slf4j
@RequestMapping(value = "/api/reptile")
@RestController
@Api(description = "爬虫Api", value = "爬虫Api")
public class ReptileMessageController {


    Logger logger = LoggerFactory.getLogger(ReptileMessageController.class);

    @Autowired
    private ReptileMessageService reptileMessageService;

    @GetMapping("/startReptile")
    @ApiOperation(value = "开始爬取")
    public JsonResult startReptile(String keyName) {

        //引用webmagic 进行数据爬取
        logger.info("==startReptile==");
        reptileMessageService.startReptile(keyName);
        logger.info("==endReptile==");
        return null;
    }


}
